// @ts-nocheck
import { Navigate, RouteObject } from "react-router-dom";
import Index from "@/pages/Home/newHome";
import Home from "@/pages/Home";
import MessageInfo from "@/pages/Message";
import User from "@/pages/User";
import EventReport from "@/pages/EventReport";
import MapLocation from "@/pages/MapLocation";
import Login from "@/pages/Login";
import AutoLogin from "@/pages/AutoLogin";
import SignSuccess from '@/pages/Login/signSuccess'
import CommunityService from "@/pages/communityService";
import CommunityServiceReport from "@/pages/communityServiceReport";
import MyCommunity from "@/pages/MyCommunity";
import ContentDetails from "@/pages/contentDetails";
import LifeCircle from "@/pages/LifeCircle";
import BranchInquiry from "@/pages/LifeCircle/components/Branch";
import CommunityCloudGuide from "@/pages/LifeCircle/components/Guide";
import GuideSearchPage from "@/pages/LifeCircle/components/Guide/components/searchPage";
import SmartPartyBuilding from "@/pages/SmartPartyBuilding";
import ListOfPartyMembers from "@/pages/SmartPartyBuilding/ListOfPartyMembers";
import PartyBuildingCulture from "@/pages/SmartPartyBuilding/partyBuildingCulture";
import ActivityOrTraining from "@/pages/SmartPartyBuilding/activityOrTraining";
import EventDetails from "@/pages/EventDetails";
import SignUp from "@/pages/EventDetails/SignUp";
import Trends from "@/pages/User/trends";
import HistoryReport from "@/pages/User/trends/historyReport";
import HistoryReportDetails from "@/pages/User/trends/historyReport/HistoryReportDetails";
import CommunityReply from "@/pages/User/trends/communityReply";
import CommunityReplyDetails from "@/pages/User/trends/communityReply/CommunityReplyDetails";
import Evaluate from "@/pages/User/trends/evaluate";
import EvaluationPublication from "@/pages/User/trends/evaluate/EvaluationPublication";
import MyEvents from "@/pages/User/trends/myEvents";
import MyActivityDetails from "@/pages/User/trends/myEvents/components/MyActivityDetails";
import ServiceMonthly from "@/pages/User/monthly";

import GuideLocation from "@/pages/LifeCircle/components/Guide/guidelocation";
import CommunityActivities from "@/pages/communityActivities";
import ActivityDetails from "@/pages/communityActivities/components/activityDetails";
import ActivityApplication from "@/pages/communityActivities/components/application";
import IntelligentGovernance from "@/pages/IntelligentGovernance";
import WallOfEchoes from "@/pages/IntelligentGovernance/WallOfEchoes";
import TheTownHall from "@/pages/IntelligentGovernance/TheTownHall";
import ProceedingsDetails from "@/pages/IntelligentGovernance/TheTownHall/proceedingsDetails";
import GotoJoin from "@/pages/IntelligentGovernance/TheTownHall/gotoJoin";
import PublicityOfIdeas from "@/pages/IntelligentGovernance/TheTownHall/publicityOfIdeas";
import ViewDetails from "@/pages/IntelligentGovernance/TheTownHall/ViewDetails";
import CommunityQuestionnaire from "@/pages/IntelligentGovernance/CommunityQuestionnaire";
import QuestionnaireSurvey from "@/pages/IntelligentGovernance/questionnaireSurvey";
import CommunityInformation from "@/pages/communityInformation";
import CommunityInfoDetail from "@/pages/communityInformation/components/infoDetail";
import AddressBook from "@/pages/AddressBook";
import PublicService from "@/pages/PublicService";
import ServiceEntry from "@/pages/PublicService/components/serviceEntry";
import ServiceFollowUp from "@/pages/PublicService/components/followUp";
import ServiceReport from "@/pages/PublicService/components/serviceEntry/components/report";
import ServiceCharacter from "@/pages/PublicService/components/serviceEntry/components/character";
import ServiceEvaluate from "@/pages/PublicService/components/serviceEntry/components/evaluate";
import ServiceCharacterSearch from "@/pages/PublicService/components/serviceEntry/components/characterSearch";
import MyWork from "@/pages/myWork";
import ServicePolicy from "@/pages/servicePolicy";
import WorkDetails from "@/pages/myWork/workDetails";
import ServerMessege from "@/pages/serverMessage";
import ServerMessageDetails from "@/pages/serverMessage/ServerMessageDetails";
import ServiceEnterForm from "@/pages/myWork/serviceEnterForm"; // 服务录入提交
import Personnel from "@/pages/myWork/personnel";// 服务计划人员列表
import ServiceScore from "@/pages/myWork/serviceEnterForm/serviceScore"; // 发表评论
import Equipment from "@/pages/equipment"; // 发表评论
import Authentication from "@/pages/authentication"; // 身份认证
import EquipmentVideo from "@/pages/equipment/equipmentVideo"; // 物联视频


const getRouter = (success: boolean) => {
  const router: RouteObject[] = [
    { path: "/login?", element: <Login /> },
    { path: "/autoLogin", element: <AutoLogin /> },
    { path: "signSuccess", element: <SignSuccess /> },
    {
      path: "/",
      element: <Home />,
      children: [
        {
          index: true,
          element: success ? (
            <Index />
          ) : (
            <Navigate to="/login" replace={true} />
          ),
        },
        { path: "messege", element: <MessageInfo /> },
        { path: "user", element: <User /> },
        { path: "/equipment", element: <Equipment /> },// 物联
      ],
    },

    // 事件上报
    {
      path: "/eventReport",
      children: [
        {
          index: true,
          element: <EventReport />,
        },
        {
          path: "location",
          element: <MapLocation />,
        },
      ],
    },
    // 社区服务
    {
      path: "/communityService",
      element: <CommunityService />,
    },
    // 身份认证
    {
      path: "/authentication",
      element: <Authentication />,
    },
    // 社区服务上报
    {
      path: "/communityServiceReport",
      children: [
        {
          index: true,
          element: <CommunityServiceReport />,
        },
        {
          path: "location",
          element: <MapLocation />,
        },
      ],
    },
    // 我的社区
    {
      path: "/myCommunity",
      element: <MyCommunity />,
    },
    // 内容详情
    {
      path: "/contentDetails",
      element: <ContentDetails />,
    },
    // 15分钟生活圈
    {
      path: "/lifeCircle",
      children: [
        { index: true, element: <LifeCircle /> },
        { path: "branch", element: <BranchInquiry /> },
        {
          path: "guide",
          children: [
            { index: true, element: <CommunityCloudGuide /> },
            {
              path: "searchpage",
              children: [
                { index: true, element: <GuideSearchPage /> },
                { path: "guidelocation", element: <GuideLocation /> },
              ],
            },
          ],
        },
      ],
    },
    // 社区活动
    { path: "/communityActivities", element: <CommunityActivities /> },
    // 社区活动-活动详情
    { path: "/activityDetails", element: <ActivityDetails /> },
    // 社区活动-活动报名
    { path: "/activityApplication", element: <ActivityApplication /> },
    // 社区资讯
    { path: "/communityInformation", element: <CommunityInformation /> },
    // 社区资讯-资讯详情
    { path: "/infoDetail", element: <CommunityInfoDetail /> },

    // 智慧党建
    { path: "/smartPartyBuilding", element: <SmartPartyBuilding /> },
    { path: "/listOfPartyMembers", element: <ListOfPartyMembers /> },
    { path: "/partyBuildingCulture", element: <PartyBuildingCulture /> },
    { path: "/activityOrTraining", element: <ActivityOrTraining /> },
    { path: "/smartPartyBuilding", element: <SmartPartyBuilding /> },
    { path: "/listOfPartyMembers", element: <ListOfPartyMembers /> },
    { path: "/partyBuildingCulture", element: <PartyBuildingCulture /> },
    { path: "/activityOrTraining", element: <ActivityOrTraining /> },
    // 活动详情
    { path: "/eventDetails", element: <EventDetails /> },
    // 报名
    { path: "/signUp", element: <SignUp /> },

    // 智慧治理
    { path: "/intelligentGovernance", element: <IntelligentGovernance /> },
    { path: "/intelligentGovernance/wallOfEchoes", element: <WallOfEchoes /> }, //社区回音壁
    { path: "/intelligentGovernance/theTownHall", element: <TheTownHall /> }, //居民议事厅
    {
      path: "/intelligentGovernance/theTownHall/proceedingsDetails",
      element: <ProceedingsDetails />,
    }, //议事详情
    {
      path: "/intelligentGovernance/theTownHall/gotoJoin",
      element: <GotoJoin />,
    }, //参与议事
    {
      path: "/intelligentGovernance/theTownHall/publicityOfIdeas",
      element: <PublicityOfIdeas />,
    }, //观点公示
    {
      path: "/intelligentGovernance/communityQuestionnaire",
      element: <CommunityQuestionnaire />,
    }, //社区问卷
    { path: "/intelligentGovernance/viewDetails", element: <ViewDetails /> }, //观点详情
    {
      path: "/intelligentGovernance/questionnaireSurvey",
      element: <QuestionnaireSurvey />,
    }, //观点详情

    // 个人中心
    { path: "/user/trends", element: <Trends /> },
    { path: "/user/trends/history", element: <HistoryReport /> },
    {
      path: "/user/trends/historyReportDetails",
      element: <HistoryReportDetails />,
    },
    { path: "/user/trends/communityReply", element: <CommunityReply /> },
    {
      path: "/user/trends/communityReplyDetails",
      element: <CommunityReplyDetails />,
    },
    { path: "/user/trends/evaluate", element: <Evaluate /> },
    {
      path: "/user/trends/evaluationPublication",
      element: <EvaluationPublication />,
    },
    { path: "/user/trends", element: <Trends /> },
    { path: "/user/trends/history", element: <HistoryReport /> },
    { path: "/user/trends/historyReportDetails", element: <HistoryReportDetails /> },
    { path: "/user/trends/communityReply", element: <CommunityReply /> },
    { path: "/user/trends/communityReplyDetails", element: <CommunityReplyDetails /> },
    { path: "/user/trends/evaluate", element: <Evaluate /> },
    { path: "/user/trends/evaluationPublication", element: <EvaluationPublication /> },
    { path: "/user/trends/myEvents", element: <MyEvents /> },
    { path: "/user/trends/MyActivityDetails", element: <MyActivityDetails /> },
    { path: "/user/serviceMonthly", element: <ServiceMonthly /> },

    // 通讯录
    { path: "/addressBook", element: <AddressBook /> },
    // 公共服务
    {
      path: "/publicService",
      children: [
        { index: true, element: <PublicService /> },
        {
          path: "entry",
          children: [
            { index: true, element: <ServiceEntry /> },
            { path: "report", element: <ServiceReport /> },
            { path: "character", element: <ServiceCharacter /> },
            { path: "charactersearch", element: <ServiceCharacterSearch /> },
            { path: "evaluate", element: <ServiceEvaluate /> },
          ],
        },
        { path: "followup", element: <ServiceFollowUp /> },
      ],
    },
    // 我的任务
    { path: "/myWork", element: <MyWork /> },
    { path: "/myWork/details", element: <WorkDetails /> },
    // 服务端消息
    { path: "/serverMessege", element: <ServerMessege /> },
    { path: "/serverMessageDetails", element: <ServerMessageDetails /> },
    // 服务政策
    { path: "/servicePolicy", element: <ServicePolicy /> },
    // 服务录入
    { path: "/serviceEnterForm", element: <ServiceEnterForm /> },
    // 人员列表
    { path: "/personnel", element: <Personnel /> },
    // 服务录入评价
    { path: "/serviceScore", element: <ServiceScore /> },
    // 物联视频
    { path: "/equipmentVideo", element: <EquipmentVideo /> },


  ];
  return router;
};

export default getRouter;
